package cn.zzp;

import org.aspectj.lang.annotation.Before;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.loadbalancer.annotation.LoadBalancerClient;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

/**
 * @ClassName OrderServerApp
 * @Description
 * @Author 祝志鹏
 * @Date 2022/8/18 18:42
 */
@SpringBootApplication
@EnableEurekaClient
public class OrderServerApp {

    public static void main(String[] args) {
        SpringApplication.run(OrderServerApp.class, args);
    }

    // 注册一个restTemplate对象到springboot中，使用此方法注册前提必须是当前类是一个配置类
    @Bean
    @LoadBalanced // 让RestTemplate拥有负载均衡能力
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }
}
